00c9b03e5030be0b1586321a86ca108d93f24723,fabric-core-agent-ssh/src/main/java/org/fusesource/fabric/service/ssh/SshAgentProvider.java,SshAgentProvider,create,#CreateAgentArguments#String#String#,78
Before Change
public boolean create(CreateAgentArguments createArgs, String name, String zooKeeperUrl) throws Exception {
if (createArgs instanceof CreateSshAgentArguments) {
CreateSshAgentArguments args = (CreateSshAgentArguments) createArgs;
boolean debugAgent = args.isDebugAgent();
String path = args.getPath();
String host = args.getHost();
int port = args.getPort();
String username = args.getUsername();
String password = args.getPassword();
int sshRetries = args.getSshRetries();
int retryDelay = args.getRetryDelay();
doCreateAgent(name, zooKeeperUrl, debugAgent, path, host, port, username, password, sshRetries, retryDelay);
return true;
} else {
return false;
After Change
* @param name The name of the Agent.
* @param zooKeeperUrl The url of Zoo Keeper.
*/
public void create(FabricService fabricService, URI agentUri, String name, String zooKeeperUrl, final boolean debugAgent) {
try {
String path = agentUri.getPath();
String host = agentUri.getHost();
if (agentUri.getQuery() != null) {
debug = agentUri.getQuery().contains("debug");
}
if (host == null) {
throw new IllegalArgumentException("host name must be specified in uri '" + agentUri + "'");
}
int port = agentUri.getPort();
if (port == -1) {
port = 22;
}
String ui = agentUri.getUserInfo();
String[] uip = ui != null ? ui.split(":") : null;
if (uip == null || uip.length != 2) {
throw new IllegalArgumentException("user and password must be supplied in the uri '" + agentUri + "'");
}
String username = uip[0];
String password = uip[1];
int sshRetries = 6;
int retryDelay = 1;
doCreateAgent(fabricService, name, zooKeeperUrl, debugAgent, path, host, port, username, password, sshRetries, retryDelay);
} catch (FabricException e) {
throw e;
} catch (Exception e) {